package com.itheima.d8_demo;

public class SilverCard extends  Card{
    public SilverCard(String carNumber, String name, String phone, double money) {
        super(carNumber, name, phone, money);
    }

    @Override
    public void consume(double money){
        System.out.println("优惠之前的价格是："+ money);
        System.out.println("使用银卡支付的价格是：" + money * 0.9);
        //判断余额是否充足
        if (getMoney() < money * 0.8) {
            System.out.println("您的余额是：" + getMoney() + "，余额不足，消费失败！请存钱！");
            return;
        }
        setMoney(getMoney() - money * 0.9);
        System.out.println("您当前剩余的余额是："+ getMoney());
    }

}

